import request from '@/util/request'
import type { Page } from '../types/page'
import type {DishesSearchParam,Dishes} from '@/api/dishes/types'

const API:string = '/dishes-service/dishes'

export const getDishesList = (pageNum:number,pageSize:number,queryForm:DishesSearchParam)=>
    request<Page<Dishes>,Page<Dishes>>({
        url:API+'/list',
        method:'get',
        params:{
            pageNum,
            pageSize,
            ...queryForm
        }

    })

export const addDishes = (form:Dishes)=>
    request<any,any,Dishes>({
        url:API,
        method:'post',
        data:form

    })

export const updateDishes = (form:Dishes)=>
    request<any,any,Dishes>({
        url:API + `/${form.id}`,
        method:'put',
        data:form
    })

export const deleteDishes = (id:number)=>
    request<any,any>({
        url:API + `/${id}`,
        method:'delete'
        
    })